package types

import (
	"news/pkg/models"
	"time"
)

type SearchNewsForm struct {
	pageForm

	Q string `json:"q" form:"q"` // 查询关键字
}

type CreateNewsForm struct {
	baseForm

	Title    string    `json:"title" form:"title" binding:"required"`
	NewsImg  string    `json:"newsImg" form:"newsImg"`
	Label    string    `json:"label" form:"label" binging:"required"`
	UserId   models.Id `json:"userId" form:"userId" swaggerignore:"true"`
	Username string    `json:"username" form:"username" swaggerignore:"true"`
	Url      string    `json:"url" form:"url" `
	Desc     string    `json:"desc" form:"desc" binging:"required"`
	Content  string    `json:"content" form:"content" binging:"required"`
	State    string    `json:"state" form:"state" binding:"required"`
}

type UpdateNewsForm struct {
	baseForm
	Id      models.Id `json:"id" swaggerignore:"true"`
	Title   string    `json:"title" form:"title" `
	NewsImg string    `json:"newsImg" form:"newsImg"`
	Label   string    `json:"label" form:"label" `
	Url     string    `json:"url" form:"url" `
	Desc    string    `json:"desc" form:"desc" `
	Content string    `json:"content" form:"content"`
	State   string    `json:"state" form:"state"`
}
type UpdateStateForm struct {
	baseForm
	State string      `json:"state"`
	Ids   []models.Id `json:"ids"`
}

type GetNewsByUserIdForm struct {
	pageForm
	UserId models.Id `swaggeringore:"true"`
}
type GetCountResp struct {
	Label string `json:"label"`
	Num   int    `json:"num"`
}

type GetNewsCountByTypeForm struct {
	baseForm
	CreatedTime bool `form:"createdTime" json:"createdTime"`
}
type DeleteNewsForm struct {
	baseForm
	Ids []models.Id `json:"ids"`
}

type GetNewsByState struct {
	pageForm
	State string `form:"state" json:"state" binding:"required"`
}
type GetNewsResp struct {
	Id        models.Id `json:"id"`
	NewsImg   string    `json:"newsImg"`
	CreatedAt time.Time `json:"createAt"`
	Title     string    `json:"title"`
	Label     string    `json:"label"`
	UserId    string    `json:"userId"`
	Username  string    `json:"userName"`
	State     string    `json:"state"`
	Url       string    `json:"url"`
	Desc      string    `json:"desc"`
	Content   string    `json:"content"`
	ReadCount int       `json:"readCount"`
}

type DeleteNewsByIdResp struct {
	Id     models.Id `json:"id"`
	UserId models.Id `json:"userId"`
	Title  string    `json:"title"`
}

type WeekNewsCountResp struct {
	Date  [7]string
	Count [7]int
}

type GetNewsListForm struct {
	pageForm
	Q string `json:"q,omitempty"`
}
